<?php
/**
 * Created by PhpStorm.
 * User: bannar
 * Date: 2018/9/26
 * Time: 10:39
 */
namespace app\api\controller\v1;
use app\api\validate\IDMustBePositiveInt;
use app\api\model\Banner as BannerModel;
use app\lib\exception\BannerMissException;
class Banner{
 public function getBanner($id){
     (new IDMustBePositiveInt())->gocheck();//验证器
     $banner=BannerModel::getBannerById($id);//模型的好处是有很多的方法
     $banner->hidden(['delete_time','update_time']);

     if(!$banner){
        throw new BannerMissException();
     }
     return $banner;
 }
}